/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package aspect.example;
import aspect.entity.Entity;
import aspect.physics.RigidBody;
import aspect.physics.dynamics.Force;
import aspect.physics.dynamics.PointGravity;
import aspect.render.ViewModel;
import aspect.world.World;
/**
*
* @author MillerV
*/
public class SpaceObject extends Entity {
private final Force gravity;
public SpaceObject(ViewModel model, float mass) {
super(model);
RigidBody rb = new RigidBody(World.main);
rb.mass = mass;
addBehavior(rb);
gravity = new PointGravity(this);
World.main.addForce(gravity);
}
@Override
public void onRemove() {
super.onRemove();
World.main.removeForce(gravity);
}
}